﻿using System;
using System.Web;
using BikeBouncer.BusinessLayer;
using Devv.Core.Utils;

namespace BikeBouncer.Site
{
	public class Global : HttpApplication
	{
		#region Application events

		protected void Application_Start(Object sender, EventArgs e)
		{
			SetDefaults();
		}

		protected void Application_Error(Object sender, EventArgs e)
		{
			Devv.Core.Erroo.ErrorHandler.Handle(Server.GetLastError());
		}

		#endregion

		#region Common methods and utils

		private static void SetDefaults()
		{
			Devv.Core.Erroo.Config.LoadFromXml();
			Devv.Core.Erroo.Config.LogPath = ConfigUtil.GetConfig("BikeBouncer.DataPath") + "Logs\\Errors\\";

			Devv.Core.UniDataTier.Config.LoadFromXml("BikeBouncer");

			Settings.Load();
			
			LocationManager.Load();
		}

		#endregion
	}
}